﻿using Microsoft.CSharp.Activities;
using System;
using System.Activities;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WFExtended.Twitter.Activities.Designers;

namespace WFExtended.Twitter.Activities
{
    /// <summary>
    /// Favorites the status specified in the ID parameter as the authenticating user. 
    /// Returns the favorite status when successful.
    /// </summary>
    [ToolboxBitmapAttribute(typeof(EntryPoint), "Resources.FavoriteToolbox.bmp")]
    [Designer(typeof(FavoriteDesigner))]
    [Description("Favorites the status specified in the ID parameter as the authenticating user.")]
    public class AddFavorite : TwitterOperationInvoker<Status>
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="AddFavorite"/> class.
        /// </summary>
        public AddFavorite()
            : base("AddFavorite")
        {
            IncludeEntities = new InArgument<bool>(new CSharpValue<bool>("true"));
        }

        /// <summary>
        /// The  ID of the desired status.
        /// <remarks>
        /// Required Argument
        /// </remarks>
        /// </summary>
        /// <value>
        /// The  ID of the desired status.
        /// </value>
        [Browsable(true)]
        [Category("Parameters")]
        [Description("The  ID of the desired status.")]
        [RequiredArgument]
        public InArgument<string> ID { get; set; }

        /// <summary>
        /// The entities node will be disincluded when set to false.
        /// </summary>
        /// <value>
        /// The entities node will be disincluded when set to false
        /// </value>
        [Browsable(true)]
        [Category("Parameters")]
        [Description("The entities node will be disincluded when set to false")]
        [RequiredArgument]
        public InArgument<bool> IncludeEntities { get; set; }

        /// <summary>
        /// Caches the metadata.
        /// </summary>
        /// <param name="metadata">The metadata.</param>
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            RuntimeArgument idArgument = new RuntimeArgument("ID", typeof(string), ArgumentDirection.In, true);
            metadata.Bind(ID, idArgument);
            metadata.AddArgument(idArgument);

            RuntimeArgument includeEntitiesArgument = new RuntimeArgument("IncludeEntities", typeof(bool), ArgumentDirection.In, true);
            metadata.Bind(IncludeEntities, includeEntitiesArgument);
            metadata.AddArgument(includeEntitiesArgument);

            base.CacheMetadata(metadata);
        }

        /// <summary>
        /// Executes the specified context.
        /// </summary>
        /// <param name="context">The context.</param>
        protected override void Execute(NativeActivityContext context)
        {
            Parameters.Clear();

            Parameters.Add("statusID", ID);
            Parameters.Add("includeEntities", IncludeEntities);

            base.Execute(context);
        }


    }
}
